<?php
$this->breadcrumbs = array(
    'Articles' => array('index'),
    $model->title,
);

$this->menu = array(
    array('label' => 'List Article', 'url' => array('index')),
    array('label' => 'Create Article', 'url' => array('create')),
    array('label' => 'Update Article', 'url' => array('update', 'id' => $model->id)),
    array('label' => 'Delete Article', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')),
    array('label' => 'Manage Article', 'url' => array('admin')),
);
?>
<div class="main">
    <div class="post">
        <div class="title">
            <?php echo CHtml::encode($model->title); ?>
        </div>
        <div class="author">
            posted by <?php echo $model->author->username . ' on ' . date('F j, Y', $model->create_time); ?>
        </div>
        <div class="content">
            <?php
            $this->beginWidget('CMarkdown', array('purifyOutput' => true));
            echo $model->content;
            $this->endWidget();
            ?>
        </div>
        <div class="nav">
            <b>Tags:</b>
            <?php echo implode(', ', $model->tagLinks); ?>
            <br/>
            <?php echo CHtml::link('Permalink', $model->url); ?> |
            <?php echo CHtml::link("Comments ({$model->commentCount})", $data->url . '#comments'); ?> |
            Last updated on <?php echo date('F j, Y', $model->update_time); ?>
        </div>
    </div>
    <div id="comments">
        <?php if ($model->commentCount >= 1): ?>
            <h3>
                <?php echo $model->commentCount > 1 ? $model->commentCount . ' comments' : 'One comment'; ?>
            </h3>

            <?php
            $this->renderPartial('_comments', array(
                'article' => $model,
                'comments' => $model->comments,
            ));
            ?>
        <?php endif; ?>

        <h3>Leave a Comment</h3>

        <?php if (Yii::app()->user->hasFlash('commentSubmitted')): ?>
            <div class="flash-success">
                <?php echo Yii::app()->user->getFlash('commentSubmitted'); ?>
            </div>
        <?php else: ?>
            <?php
            $this->renderPartial('/comment/_form', array(
                'model' => $comment,
            ));
            ?>
        <?php endif; ?>

    </div><!-- comments -->
</div>
<div class="sidebar">
    <div class="box">
        <h3>文章分类</h3>
        <ul>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Zend Framework</a><span>(39)</span></li>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Zend Framework</a><span>(39)</span></li>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Zend Framework</a><span>(39)</span></li>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Zend Framework</a><span>(39)</span></li>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Zend Framework</a><span>(39)</span></li>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Zend Framework</a><span>(39)</span></li>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Zend Framework</a><span>(39)</span></li>
            <li><a href="#">Yii Framework</a><span>(39)</span></li>
            <li><a href="#">Zend Framework</a><span>(39)</span></li>
        </ul>
    </div>
</div>
